/*
 * Copyright (c) 2023, 2023,yzc.cn All rights reserved.
 *
 */
package cn.yzc.until;

import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.InputStream;

/**
 * <p>Project: MybatisPro - FactoryUtils</p>
 * <p>Powered by yzc On 2023-10-08 20:48:49</p>
 * <p>描述：<p>
 *
 * @author yzc [yzc0415@126.com]
 * @version 1.0
 * @since 17
 */
public class FactoryUtils {
    private static final FactoryUtils instance;

    private static SqlSessionFactory sqlSessionFactory;

    static {
        instance = new FactoryUtils();
    }

    private FactoryUtils() {
        SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
        InputStream is = this.getClass().getClassLoader().getResourceAsStream("mybatis-config.xml");
        sqlSessionFactory = builder.build(is);
    }

    /**
     * @return 返回会话工厂
     */
    public static SqlSessionFactory sqlSessionFactory() {
        return sqlSessionFactory;
    }

}



